<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="所在机构">
              <j-select-depart v-model="queryParam.unit" :trigger-change="true" customReturnField="id"
                               :multi="true"></j-select-depart>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="性别">
              <j-dict-select-tag style="width: 100%" placeholder="请选择" dict-code="sex1" v-model="queryParam.sex"/>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="姓名">
              <a-input placeholder="请输入" v-model="queryParam.name"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :md="6" :sm="8">
              <a-form-item label="学历">
                <a-input placeholder="请输入" v-model="queryParam.education"></a-input>
              </a-form-item>
            </a-col>
          </template>
          <a-col :md="6" :sm="8">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">清除条件</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span slot="actionName">
          <a-button size="small" @click="handleAdd('新增专家管理')" v-has="'expert:add'"
                    type="primary" icon="plus">新增</a-button>
        </span>
        <span slot="category" slot-scope="text, record">
          {{record.category == '1' ? '内部人员' : '外部人员'}}
        </span>
        <span slot="action" slot-scope="text, record">
          <span v-has="'expert:detail'">
            <a @click="handleCheck(record, '审计专家管理-查看')">查看</a>
            <a-divider type="vertical"/>
          </span>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item v-has="'expert:edit'">
                <a @click="handleEdit(record, '审计专家管理-编辑')">编辑</a>
              </a-menu-item>
              <a-menu-item v-has="'expert:del'">
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
  </a-card>
</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import CheckAndEditModel from './CheckAndEditModel'
  import columns from './indexColumns'

  export default {
    name: 'sjzjgl',
    mixins: [JeecgListMixin],
    components: {
      CheckAndEditModel
    },
    data() {
      return {
        queryParam: {},
        // 表头
        columns: columns(this),
        url: {
          list: '/sjzyzhgl/sjResourceExpert/queryExpertPersonList',
          delete: '/sjzyzhgl/sjResourceExpert/delete'
        },
      }
    },
    created() {
      if (this.$route.params) {
        this.queryParam.unit = this.$route.params.unit
      }
    },
    methods: {},
  }
</script>

<style scoped>
  @import '~@assets/less/common.less';
</style>